//////////////////////////////////////////////////////////////////////////
//
// HHeaven Studio Source File
//
// Name:   	MainLayer.h
// Desc:		
// 	
// Author:  Kaiming
// Date:	2012/5/6
// Modify:	2012/5/6
// 
//////////////////////////////////////////////////////////////////////////

#ifndef _MainLayer_h_
#define _MainLayer_h_

#include "cocos2d.h"


class MainLayer : public cocos2d::CCLayer
{
public:
	// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
	virtual bool init();  

	// there's no 'id' in cpp, so we recommand to return the exactly class pointer
	static cocos2d::CCScene* scene();

	static cocos2d::CCLayer* getRootLayer();
	
	virtual void update(cocos2d::ccTime dt);
	virtual void draw(void);

	// a selector callback
	virtual void menuCloseCallback(CCObject* pSender);
	virtual void menuRestartCallback(CCObject* pSender);
	virtual void menuSwitchCallback(CCObject* pSender);

	// implement the "static node()" method manually
	LAYER_NODE_FUNC(MainLayer);

	virtual void ccTouchesBegan( cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent );

	virtual void ccTouchesMoved( cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent );

	virtual void ccTouchesEnded( cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent );

	virtual void ccTouchesCancelled( cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent );

	virtual bool ccTouchBegan( cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent );

	virtual void ccTouchMoved( cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent );

	virtual void ccTouchEnded( cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent );

	virtual void ccTouchCancelled( cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent );


private:
	class IPaletteBase* m_pPalette2x2;
	class IPaletteBase* m_pPalette3x3;
	class IPaletteBase* m_pPalette4x4;
	class IPaletteBase* m_pPalette5x5;

	class IPaletteBase* m_pPaletteCurr;


	cocos2d::CCLabelTTF* m_pTouchPos;
	cocos2d::CCPoint m_fingerStartGL;
	cocos2d::CCPoint m_fingerStopGL;

	cocos2d::CCPoint m_fingerStart;
	cocos2d::CCPoint m_fingerStop;

	int	m_nFingerStatus;
};

#endif // __HELLOWORLD_SCENE_H__
